package com.fragments.sendmail;

import hu.scythe.droidwriter.DroidWriterEditText;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ToggleButton;

import com.fragments.BaseFragment;
import com.senditcertified.mail.R;

public class MessageFragment extends BaseFragment {
	private EditText mEdtSubject;
	ToggleButton boldToggle, italicsToggle, underlinedToggle; 
	Button clearButton;
	DroidWriterEditText dwEdit;

	@Override
	protected void initViews() {
		boldToggle = (ToggleButton) getView().findViewById(R.id.BoldButton);
		italicsToggle = (ToggleButton) getView().findViewById(R.id.ItalicsButton);
		underlinedToggle = (ToggleButton) getView().findViewById(R.id.UnderlineButton);
		clearButton = (Button) getView().findViewById(R.id.ClearButton);
		dwEdit = (DroidWriterEditText) getView().findViewById(R.id.dwEdt);
		
		dwEdit.setSingleLine(false);
		dwEdit.setBoldToggleButton(boldToggle);
		dwEdit.setItalicsToggleButton(italicsToggle);
		dwEdit.setUnderlineToggleButton(underlinedToggle);
		dwEdit.setMinLines(10);
		dwEdit.setClearButton(clearButton);
		
		mEdtSubject = (EditText) getView().findViewById(R.id.edt_subject);

	}

	
	@Override
	protected void initComponents() {
		// TODO Auto-generated method stub

	}

	@Override
	protected void addListener() {
		// TODO Auto-generated method stub

	}

	@Override
	protected int initLayout() {
		// TODO Auto-generated method stub
		return R.layout.sendmail_message_fragment;
	}

	public String getSubject() {
		return mEdtSubject.getText().toString().trim();
	}

	public String getMessage() {
		return dwEdit.getTextHTML().replaceAll("\\n", "").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
	}

}
